﻿CREATE TABLE `open_purchase_check_order` (
  `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(60) NOT NULL DEFAULT '',
  `depot_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `seat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `order_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `order_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_brief` tinytext NOT NULL,
  `add_time` int(10) unsigned NOT NULL DEFAULT '0',
  `loss_order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  UNIQUE KEY `order_sn` (`order_sn`),
  KEY `depot_id` (`depot_id`),
  KEY `seat_id` (`seat_id`),
  KEY `loss_order_id` (`loss_order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;

#
# Source for table open_purchase_check_order_goods
#

CREATE TABLE `open_purchase_check_order_goods` (
  `rec_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `color_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `size_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `norm_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `norm_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_mount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_brief` tinytext NOT NULL,
  PRIMARY KEY (`rec_id`),
  UNIQUE KEY `un` (`order_id`,`goods_id`,`color_id`,`size_id`),
  KEY `goods_id` (`goods_id`),
  KEY `color_id` (`color_id`),
  KEY `size_id` (`size_id`),
  KEY `order_id` (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_confirm_order
#

CREATE TABLE `open_purchase_confirm_order` (
  `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(60) NOT NULL DEFAULT '',
  `supplier_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `depot_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `seat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `deliver_time` int(10) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `order_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `order_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_brief` tinytext NOT NULL,
  `add_time` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  KEY `supplier_id` (`supplier_id`),
  KEY `depot_id` (`depot_id`),
  KEY `seat_id` (`seat_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_confirm_order_goods
#

CREATE TABLE `open_purchase_confirm_order_goods` (
  `rec_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `color_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `size_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `norm_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `norm_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_mount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_brief` tinytext NOT NULL,
  `ext_goods_number_finish` smallint(5) unsigned NOT NULL DEFAULT '0',
  `ext_goods_number_unfinish` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`rec_id`),
  UNIQUE KEY `un` (`order_id`,`goods_id`,`color_id`,`size_id`),
  KEY `goods_id` (`goods_id`),
  KEY `color_id` (`color_id`),
  KEY `size_id` (`size_id`),
  KEY `order_id` (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_loss_order
#

CREATE TABLE `open_purchase_loss_order` (
  `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(60) NOT NULL DEFAULT '',
  `depot_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `seat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number_loss` smallint(5) NOT NULL DEFAULT '0',
  `order_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `order_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_brief` tinytext NOT NULL,
  `add_time` int(10) unsigned NOT NULL DEFAULT '0',
  `rectify_order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  UNIQUE KEY `order_sn` (`order_sn`),
  KEY `depot_id` (`depot_id`),
  KEY `seat_id` (`seat_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_loss_order_goods
#

CREATE TABLE `open_purchase_loss_order_goods` (
  `rec_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `color_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `size_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number_inventory` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number_loss` smallint(5) NOT NULL DEFAULT '0',
  `actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_norm_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_norm_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_actual_mount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_goods_brief` tinytext NOT NULL,
  PRIMARY KEY (`rec_id`),
  UNIQUE KEY `un` (`order_id`,`goods_id`,`color_id`,`size_id`),
  KEY `goods_id` (`goods_id`),
  KEY `color_id` (`color_id`),
  KEY `size_id` (`size_id`),
  KEY `order_id` (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_order
#

CREATE TABLE `open_purchase_order` (
  `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(60) NOT NULL DEFAULT '',
  `supplier_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `depot_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `seat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `deliver_time` int(10) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `order_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `order_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_brief` tinytext NOT NULL,
  `add_time` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  KEY `supplier_id` (`supplier_id`),
  KEY `depot_id` (`depot_id`),
  KEY `seat_id` (`seat_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_order_action
#

CREATE TABLE `open_purchase_order_action` (
  `action_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `ctype` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `action_user` varchar(30) NOT NULL DEFAULT '',
  `order_status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `action_note` varchar(255) NOT NULL DEFAULT '',
  `log_time` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`action_id`),
  KEY `order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_order_goods
#

CREATE TABLE `open_purchase_order_goods` (
  `rec_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `color_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `size_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `norm_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `norm_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_mount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_brief` tinytext NOT NULL,
  `ext_goods_number_finish` smallint(5) unsigned NOT NULL DEFAULT '0',
  `ext_goods_number_unfinish` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`rec_id`),
  UNIQUE KEY `spec_unique` (`order_id`,`goods_id`,`size_id`,`color_id`),
  KEY `purchase_order_id` (`order_id`),
  KEY `goods_id` (`goods_id`),
  KEY `color_id` (`color_id`),
  KEY `size_id` (`size_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_rectify_order
#

CREATE TABLE `open_purchase_rectify_order` (
  `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(60) NOT NULL DEFAULT '',
  `depot_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `seat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `order_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `order_status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `order_brief` tinytext NOT NULL,
  `add_time` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`order_id`),
  UNIQUE KEY `order_sn` (`order_sn`),
  KEY `depot_id` (`depot_id`),
  KEY `seat_id` (`seat_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

#
# Source for table open_purchase_rectify_order_goods
#

CREATE TABLE `open_purchase_rectify_order_goods` (
  `rec_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `color_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `size_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number_inventory` smallint(5) unsigned NOT NULL DEFAULT '0',
  `goods_number_rectify` smallint(5) NOT NULL DEFAULT '0',
  `actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_norm_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_discount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_norm_amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_actual_mount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `ext_goods_brief` tinytext NOT NULL,
  PRIMARY KEY (`rec_id`),
  UNIQUE KEY `un` (`order_id`,`goods_id`,`color_id`,`size_id`),
  KEY `goods_id` (`goods_id`),
  KEY `color_id` (`color_id`),
  KEY `size_id` (`size_id`),
  KEY `order_id` (`order_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;